package com.xunk.equipment.controller;

import com.xunk.common.core.web.domain.AjaxResult;
import com.xunk.equipment.service.acrel.service.AcrelSmartService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.ParseException;

/**
 * @ProjectName: xunk
 * @Package: com.xunk.equipment.controller
 * @ClassName: SmartWaterController
 * @Author: dongxiaoxin
 * @Description: 水表服务
 * @Date: 2021/3/30 17:00
 * @Version: 1.0
 */
@RequestMapping("/water")
@RestController
public class SmartWaterController {

    @Resource(name = "acrel-water-meter")
    AcrelSmartService service;

    @GetMapping("/meter")
    public AjaxResult queryFlowmeterByDate(String unit,Long homeId) throws ParseException {
        return AjaxResult.success(service.queryFlowmeter(homeId, unit));
    }

    @GetMapping("/online")
    public AjaxResult queryOnline(String deviceSn){
        return AjaxResult.success(service.queryOnlineInfo(deviceSn));
    }
}
